import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '订单单号',
    align: 'center',
    dataIndex: 'orderCode',
    resizable: true,
  },
  {
    title: '门店',
    align: 'center',
    dataIndex: 'storeName',
  },
  {
    title: '订单日期',
    align: 'center',
    dataIndex: 'orderCreateTime',
  },
  {
    title: '包裹信息',
    align: 'center',
    slots: { customRender: 'logiInfo' },
    dataIndex: 'logiOrder',
    resizable: true,
  },
  // {
  //   title: '产品upc编码',
  //   align: 'center',
  //   dataIndex: 'upcCode',
  // },
  // {
  //   title: '包裹数',
  //   align: 'center',
  //   dataIndex: 'num',
  // },
];

//明细列表数据
export const detailColumns: BasicColumn[] = [
  {
    title: '产品upc编码',
    align: 'center',
    dataIndex: 'upcCode',
  },
  {
    title: '商品名称',
    align: 'center',
    dataIndex: 'productName',
  },
  {
    title: '包裹数',
    align: 'center',
    dataIndex: 'num',
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: 'HTM单号',
    field: 'orderCode',
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: '物流单号',
    field: 'logiOrder',
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: '门店',
    field: 'storeName',
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: '创建时间',
    field: 'orderCreateTime',
    component: 'RangePicker',
    componentProps: {
      valueType: 'Date',
    },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '订单单号',
    field: 'orderCode',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入订单单号!'},
          ];
     },
  },
  {
    label: '物流公司',
    field: 'logiCom',
    component: 'Input',
  },
  {
    label: '物流单号',
    field: 'logiOrder',
    component: 'Input',
  },
  {
    label: '产品upc编码',
    field: 'upcCode',
    component: 'Input',
  },
  {
    label: '包裹数',
    field: 'num',
    component: 'InputNumber',
  },
  {
    label: '租户号',
    field: 'tenantId',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  orderCode: {title: '订单单号',order: 0,view: 'text', type: 'string',},
  logiCom: {title: '物流公司',order: 1,view: 'text', type: 'string',},
  logiOrder: {title: '物流单号',order: 2,view: 'text', type: 'string',},
  upcCode: {title: '产品upc编码',order: 3,view: 'text', type: 'string',},
  num: {title: '包裹数',order: 4,view: 'number', type: 'number',},
  tenantId: {title: '租户号',order: 5,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}